package com.smart.expand.factory;

import org.springframework.beans.factory.FactoryBean;

/**
 * @author jiangjun
 */
public class DefaultFactoryBean<T> implements FactoryBean<T> {

    private Class<T> clientClass;

    public Class<T> getClientClass() {
        return clientClass;
    }

    public void setClientClass(Class<T> clientClass) {
        this.clientClass = clientClass;
    }

    public DefaultFactoryBean() {
    }

    public DefaultFactoryBean(Class<T> clientClass) {
        this.clientClass = clientClass;
    }

    public DefaultFactoryBean(String className) {
        try{
            this.clientClass = (Class<T>) Class.forName(className);
        }catch(ClassNotFoundException e){
            e.printStackTrace();
        }
    }

    @Override
    public boolean isSingleton() {
        return true;
    }

    @Override
    public T getObject() throws Exception {
        return null;
    }

    @Override
    public Class<?> getObjectType() {
        return null;
    }

    @Override
    public String toString() {
        return "DefaultFactoryBean{" +
                "clientClass=" + clientClass +
                '}';
    }
}
